const app = getApp();
const server_prefix = "/api/chat";
const service = {
  switch_teaching_plan() {
    return app.request({
      url: `${server_prefix}/switch_teaching_plan?plan_id=1`,
      method: "get",
    });
  },
  // 词典翻译
  translate_dict(word) {
    return app.request({
      url: `${server_prefix}/translate_dict`,
      data: {
        content:word
      },
      method: "post",
    });
  },
  // 添加到词典
  add_practice_record(word,isDel) {
    return app.request({
      url: `${server_prefix}/add_practice_record`,
      data: {
        content:word,
        "operation": isDel?"del":'add' // add or del，默认为add添加
      },
      method: "post",
    });
  },
  // 语音转文字
  voice_recognition(data) {
    return app.request({
      url: `${server_prefix}/voice_recognition`,
      data: data,
      method: "post",
    });
  },
  // 文字转语音
  text_to_voice(data) {
    return app.request({
      url: `${server_prefix}/text_to_voice`,
      data: data,
      method: "post",
    });
  },
}
  
export default service;